package com.db.stockexchange.common;

public enum OrderSide {
	BUY("1"), SELL("2");

	private String side;
	
	private OrderSide(String side) {
		this.side = side;
	}
	
	public static OrderSide fromString(String side) {
		switch (side) {
		case "1": return BUY;
		case "2": return SELL;
		default:
			throw new IllegalArgumentException("Illegal order side");
		}
	}
	
	public String asString() {
		return side;
	}
}
